package com.min.common.logger;

import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public class P6SpyLogger implements MessageFormattingStrategy {
    @Override
    public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
        return sql != null && sql.length() > 0 ? String.format("[time：%dms] %s",elapsed,sql.replaceAll("[\\s]+", " ")) : "";
    }
}
